package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Applicant;
import cn.wolfcode.trip.base.domain.CityPlay;
import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.mapper.ApplicantMapper;
import cn.wolfcode.trip.base.mapper.CityPlayMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IApplicantService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Copyright: Copyright (c) 2019 Super520
 * 描述：大攻略业务层
 *
 * @package: cn.wolfcode.trip.base.service.impl
 * @author: Patch
 * @date: 2019/5/23 22:59
 * 总结:
 */
@Service
public class ApplicantServiceImplImpl implements IApplicantService {
    @Autowired
    private ApplicantMapper applicantMapper;

    @Autowired
    private CityPlayMapper cityPlayMapper;



    @Override
    public void saveOrUpdate(Applicant applicant) {
        if (applicant.getId() != null) {
            applicantMapper.updateByPrimaryKey(applicant);
        } else {
            applicantMapper.insert(applicant);
        }
    }

    @Override
    public Applicant get(Long id) {
        return applicantMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Applicant> listAll(Integer state) {
        return applicantMapper.selectAll();
    }

    @Override
    public List<User> selectAllBycityPlayId(Long cityPlayId) {
        List<User> applicantList = applicantMapper.selectForList(cityPlayId);
        return applicantList;
    }
}
